package com.mall.ware.service;

import com.mall.common.page.PageData;
import com.mall.common.service.CrudService;
import com.mall.ware.dto.WareSkuDTO;
import com.mall.ware.dto.WareSkuLockDto;
import com.mall.ware.entity.WareSkuEntity;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author xjc xjc@163.com
 * @since 1.0.0 2022-07-17
 */
public interface WareSkuService extends CrudService<WareSkuEntity, WareSkuDTO> {

    PageData<WareSkuDTO> queryPageByCondition(Map<String, Object> params);

    void addStock(Long skuId, Long wareId, Integer skuNum) throws RuntimeException;

    List<Long> hasStock(List<Long> skuIds);

    void orderLockStock(WareSkuLockDto dto) throws RuntimeException ;

    void unLockStock(Long id, Long skuId, Long wareId, Integer skuNum);

    void reduceStock(Long wareId, Long skuId, Integer skuNum);
}